<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '病种列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="disease-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p style="width:800px;margin:0 auto;">
        <?= Html::a('新增 病种', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <br />

    <table class="layui-table" style="width:800px;margin:0 auto;">
        <thead>
            <tr>
                <th style="display:none">id</th>
                <th width="400">名称</th>
                <th width="80">排序</th>
                <th width="120">是否显示</th>
                <th width="200">编辑</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($data_tree as $p) { ?>
                <tr>
                    <td style="display:none"><?= $p['id'] ?></td>
                    <td><?= $p['name'] ?></td>
                    <td><?= $p['sort'] ?></td>
                    <td><?= $p['status'] ?></td>
                    <td> <a href="<?php echo Url::toRoute(['disease/update', 'id' => $p['id']]); ?>" class="layui-btn layui-btn-normal layui-btn-xs">编辑</a> </td>
                </tr>
                <?php if (null != $p['children']) {
                    foreach ($p['children'] as $d) { ?>
                        <tr>
                            <td style="display:none"><?= $p['id'] ?></td>
                            <td> ———— <?= $d['name'] ?></td>
                            <td><?= $d['sort'] ?></td>
                            <td><?= $d['status'] ?></td>
                            <td> <a href="<?php echo Url::toRoute(['disease/update', 'id' => $d['id']]); ?>" class="layui-btn layui-btn-normal layui-btn-xs" onclick="disease_edit()">编辑</a> </td>
                        </tr>
                <?php }
                } ?>
            <?php } ?>
        </tbody>
    </table>

</div>